package pub.cleangao.mybatis.util;


import pub.cleangao.common.unique.Scale62Convertor;
import java.util.ArrayList;
import java.util.List;

/**
 * 生成表名标识
 */
public class TableNameAs {


    private static final String first = "a1";

    public static String next(List<String> occupy) {
        if (occupy == null) {
            occupy = new ArrayList<>();
        }
        if (occupy.isEmpty()) {
            occupy.add(first);
            return first;
        }
        String max = occupy.get(occupy.size() - 1);
        long next10 = Scale62Convertor.scale62To10(max) + 1;
        String nextStr = Scale62Convertor.scale10To62(next10).toLowerCase();
        occupy.add(nextStr);
        return nextStr;
    }


}
